<template>
	<view class="feedback">
		<view>内容描述<text style="color: #E90000;"> *</text></view>
		<textarea v-model="content" style="width: 670rpx;height: 184rpx;background: #F6F6F6;border-radius: 10rpx;font-size: 28rpx;color: #999999;padding:20rpx;margin:16rpx 0 40rpx;" placeholder="请输入反馈内容"></textarea>
		<view style="margin-bottom:16rpx;">截图（选填）</view>
		<image @click="upImage" style="width:204rpx;height:196rpx;border-radius:10rpx;" :src="images ||'/static/image/02_10df.png'"></image>
		<view class="buttons" @click="tijiao">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				images:'',
				content:''
			};
		},
		methods:{
			upImage(){
				var that = this
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album','camera'], //从相册选择
					success: function (res) {
						that.$upShop('upload',res.tempFilePaths[0]).then(rex => {
							let arr = JSON.parse(rex.data)
							console.log(arr,'-----------')
							that.images = arr.fileName
						})
					}
				})
			},
			tijiao(){
				this.$httpapi('fankui', 'POST', {
					content:this.content,
					img:this.images
				}).then(res => {
					uni.showToast({
						title: res.msg,
						duration: 1500,
						icon:'none'
					});
					if(res.code==200){
						setTimeout(()=>{
							uni.navigateBack()
						}, 1500)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.feedback{
	font-weight: bold;
	color: #333;
	padding:20rpx;
	.buttons{
		margin:200rpx auto 0;
		text-align: center;
		width: 710rpx;
		height: 88rpx;
		background: linear-gradient(180deg, #2089FF 0%, #11ACEF 100%);
		border-radius: 44rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 88rpx;
	}
}
</style>
